package JavaUtils.test_socket.demo01;

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;

public class Client01 {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",8050);
        PrintStream ps=new PrintStream(new BufferedOutputStream(socket.getOutputStream()));
        BufferedReader br=new BufferedReader(new InputStreamReader(socket.getInputStream()));
 
        ps.println("hello word!!");
        ps.flush();
 
        String info=br.readLine();
        System.out.println(info);
        ps.close();
        br.close();

    }
}
